package controls;

import java.util.Observable;
import java.util.Observer;

import models.ServicoTNode;

import views.PanFunBuscarServico;
import views.WinFuncionario;

public class ControllerFunBuscarServico implements Observer{
	private PanFunBuscarServico pan_fun_buscar_servico = new PanFunBuscarServico();
	private WinFuncionario winFuncionario;
	
	public void setPanel(WinFuncionario windowFuncionario){
		winFuncionario = windowFuncionario;
		
		pan_fun_buscar_servico.criaPanel();
		pan_fun_buscar_servico.addObserver(this);
		
		winFuncionario.setContent(pan_fun_buscar_servico.getPanel());
	}
	
	
	@Override
	public void update(Observable arg0, Object arg1) {
		String temp = new String((String) arg1);
		int key_servico_id = Integer.parseInt(temp);
		ServicoTNode myNode = (ServicoTNode)ControllerLogin.getPersistence().find("ServicoTree", key_servico_id);
		ControllerFunVerServico verServ = new ControllerFunVerServico();
		verServ.setPanel(myNode, winFuncionario);
	}

}
